package com.kotlin.lib.coroutines

import kotlinx.coroutines.*

fun main() = runBlocking<Unit> {
    val parent = launch {
        val child = launch {
            try {
                delay(Int.MAX_VALUE * 1L)
            } finally {
                println("job cancel")
            }
        }
        yield()
        println("canceling child.")
        child.cancelAndJoin()
        yield()
        println("......")
    }
    parent.join()
}